﻿using System;
using System.Collections.Generic;
using System.Linq;
using Com.PhilChuang.Mobile.Apps.LocationSender.Ui.Views.Impl.ViewModels;
using Microsoft.Phone.Controls.Maps;

namespace Com.PhilChuang.Mobile.Apps.LocationSender.Ui.Views.Impl.Pages
{
	public sealed partial class SelectFormatPage : SelectFormatPageBase
	{
		#region Events
		public event Action SendMessage = delegate { }; 
		#endregion

		#region Instance members (EMPTY)
		#endregion

		#region Properties (EMPTY)
		#endregion

		#region Constructors / Init
		public SelectFormatPage ()
		{
			InitializeComponent ();
			SetApplicationBarItems ();
		}
		#endregion

		#region Event handlers
		private void ListBox_SelectionChanged (object sender, System.Windows.Controls.SelectionChangedEventArgs e)
		{
			if (e.AddedItems.Count == 0) return;
			var formatAndResult = (FormatAndResult) e.AddedItems[0];
			ViewModel.Format = formatAndResult.Format;
			SendMessage ();
		}
		#endregion

		#region Functionality (EMPTY)
		#endregion

		#region Private methods
		protected override Map MapControl { get { return g_Map; } }
		#endregion

		#region Utility methods
		#endregion
	}

	public class SelectFormatPageBase : AbstractLocationSenderAppPageBase<SelectFormatPageViewModel>
	{
		protected override Map MapControl { get { return null; } }
	}
}